{% extends "ponsol2web/email/base_generic.html" %}
{% load my_filter %}
{% block title %} Detail {% endblock %}

{% block content_title %} Result Detail{% endblock %}
{% block content %}

    <div>

        {# 分组数据 #}
        {% if record_group %}
            {% for record_list in record_group %}
                <div class="panel panel-primary">
                    <div class="panel-heading">
                        Protein {{ forloop.counter }}:
                        {% if record_list.0.seq_id %}
                            {#                            {{ record_list.0.seq_id }} ({{ record_list.0.get_seq_id_type_display }})#}
                            {{ record_list.0.get_seq_id_type_display }} is {{ record_list.0.seq_id }}
                        {% else %}
                            No ID provided
                        {% endif %}
                    </div>
                    <div class="panel-body">
                        {#                        <p>Protein id:#}
                        {#                            {% if record_list.0.seq_id %}#}
                        {#                                {{ record_list.0.seq_id }} ({{ record_list.0.get_seq_id_type_display }})#}
                        {#                                                                {{ record_list.0.get_seq_id_type_display }} is {{ record_list.0.seq_id }}#}
                        {#                            {% else %}#}
                        {#                                Only provide FASTA sequence#}
                        {#                            {% endif %}#}
                        {##}
                        {#                        </p>#}
                        <p>
                            Protein name: {{ record_list.0.name | shorten_str }};<br>
                            Protein sequence: {{ record_list.0.seq | shorten_str }};
                        </p>
                    </div>
                    <table class="table">
                        <tr class="row">
                            <th class="col-md-1">#</th>
                            <th class="col-md-3 ">Variation</th>
                            <th class="col-md-3 ">Predict result</th>
                            <th class="col-md-5 ">Remark</th>
                        </tr>
                        {% for record in record_list %}
                            <tr class="row">

                                <td> {{ forloop.counter }}</td>
                                <td>
                                     {{ record.aa }}
                                </td>
                                <td>
                                    {% if record.solubility %}
                                        {{ record.get_solubility_display }}
                                        {#                                        {% elif record.status %}#}
                                    {% else %}
                                        <span class="text-danger">
                                                {{ record.status }}
                                        </span>
                                    {% endif %}
                                </td>
                                <td>
                                    {% if record.error_msg %}
                                        {{ record.error_msg }}
                                    {% else %}
                                        -
                                    {% endif %}
                                    {#                                    <a href="{% url "ponsol2:record-detail" record.id %}"> see details</a>#}
                                </td>
                            </tr>
                        {% endfor %}
                    </table>
                </div>
            {% endfor %}
        {% endif %}
    </div>
    <div>
        <ul class="nav nav-list" style="margin:10px;">
            <li class="divider"></li>
        </ul>
        <h5 class="page-header" style="margin: 10px"></h5>
        <div>
            <br>
            <p>
                If you find that there is no result or some variation have been missed, it is usually due to an incorrect
                input format.
                Please check whether all variations can be matched to input FASTA sequence.
            </p>
        </div>
    </div>
    {% if task.status == "running" %}
        <script type="text/javascript">
            function myrefresh() {
                window.location.reload();
            }

            setTimeout("myrefresh()", 1000);
        </script>
    {% endif %}
{% endblock %}
